package com.open.capacity.paper.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.open.capacity.common.exception.service.ServiceException;
import com.open.capacity.common.model.Question;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import java.util.Set;

public interface QuestionService extends IService<Question> {
    /**
     * 分页查询
     *
     * @param params Map<String, Object>
     * @return PageResult
     */
    PageResult<Question> getQuestions(Map<String, Object> params) throws ServiceException;

    /**
     * 更新
     *
     * @param question Question
     * @return Result
     */
    Result updateQuestion(Question question) throws ServiceException;

    /**
     * 插入
     *
     * @param question Question
     * @return Result
     */
    Result saveQuestion(Question question) throws ServiceException;

    /**
     * 逻辑删除
     *
     * @param questionId 问题ID
     * @return Result
     */
    Result deleteQuestion(Integer questionId) throws ServiceException;

    /**
     * 根据问卷ID获取问题
     *
     * @param paperId 问卷ID
     * @return Result
     */
    Result getAllQuestions(Integer paperId) throws ServiceException;

    /**
     * 给问卷添加问题
     *
     * @param paperId   问卷ID
     * @param questIds 问题ID集合
     * @return Result
     */
    Result addQuestions(Integer paperId, Set<Integer> questIds) throws ServiceException;

    /**
     * 导出问题
     * @param params Map<String, Object>
     * @param request 请求
     * @param response 响应
     */
    void exportQuestion(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws ServiceException;
}
